public class DiskSpace {
	public static int minDrives(int[] used, int[] total){
		int ans=0;
		int totaldata=0;
		int drivesnum=used.length;
		int[]largestorder=new int[drivesnum];
		int[]capacity=total.clone();
		for(int i=0;i<drivesnum;i++){
			int largest=capacity[i];
			int largestindex=i;
			for(int j=0;j<drivesnum;j++)
				if(largest<capacity[j]){largest=capacity[j];largestindex=j;}
			capacity[largestindex]=0;
			largestorder[i]=largestindex;
			totaldata+=used[i];
		}
		int pointer=0;
		while(totaldata>0){
			totaldata-=total[largestorder[pointer]];
			pointer++;
		}
		ans=pointer;
		return ans;
	}
	public static void main(String[] args) {
		int[]used={1,200,200,199,200,200};
		int[]total={1000,200,200,200,200,200};
		System.out.println(minDrives(used,total));
	}

}
